<template>
  <button v-if="hasAuth" @click="$emit('click')">
    <slot></slot>
  </button>
</template>

<script>
import { getButtonAuth } from '@/api/menuAdmin'

export default {
  props: {
    menuId: String,
    buttonId: String
  },
  data() {
    return {
      hasAuth: false
    }
  },
  async created() {
    const res = await getButtonAuth(this.menuId)
    this.hasAuth = res.data.includes(this.buttonId)
  }
}
</script>